require "go.app.ClientApp"

require "gravityScene"
require "gravityProtocol"

class 'gravityClientApp' (ClientApp)

function gravityClientApp:__init() super()
	math.randomseed(os.time())

	self:LoadXML("Scene.xml", true)

	self.scene = gravityScene(1)
	self:ActivateScene(self.scene)
	
	self:SetupSoundObjects()

	-- record current time
	self.lastsec = self:GetCurrentSeconds()

end

---------------------------------------------------------
-- Game Handler
---------------------------------------------------------
function gravityClientApp:OnEnterGame(player)

end

function gravityClientApp:OnLeaveGame(player)

end

function gravityClientApp:OnDisconnected()

end

function gravityClientApp:OnEnterPlayer(player)

end

function gravityClientApp:OnLeavePlayer(player)

end

function gravityClientApp:OnTimer(timerid)

end

function gravityClientApp:Update(seconds)
	self.currentScene:Update(seconds - self.lastsec)
	self.lastsec = seconds
end

---------------------------------------------------------
-- Network Handler
---------------------------------------------------------

require "gravitySoundObject"